﻿@model IDictionary<char, List<InsightAuto.Domain.Core.Manufacturer>>

@{
    var A2ZCharArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
}

@section pageHeader{
	<link href="@Url.Content("~/Content/cars.css")" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript">
        $(function () {
            $("#tabs ul li a").button();
        });
	</script>

}
@section mainHeader{
<div class="mainDiv">
    <div id="tabs">
        <ul>
            <li>@Html.ActionLink("品牌", "Manufacturer")</li>
            <li>@Html.ActionLink("价格", "Price")</li>
            <li>@Html.ActionLink("类型", "Class")</li>
        </ul>
    </div>
</div>
}
<script type="text/javascript">
    $(function () {
        $("div.toolBar a").button();

        $(".brandsTD table tr:odd").addClass("alternateRow");
    });
</script>

<div>
    <div class="toolBar">
    @foreach (var c in A2ZCharArray)
    {
        <a href="#@(c)">@c</a>
    }
    </div>
    

    @foreach (var c in A2ZCharArray)
     {
    <div class="layer1">
        <div class="layer1Title"><a name="@c">@c</a></div>
        <div class="layer1Content">
            <table class="manufacturerTable" cellspacing="6px">
            @if (Model.ContainsKey(c))
            {
                int i=0;
                while (i < Model[c].Count)
                {
                    if (i % 2 == 0)
                    {
                @:<tr>
                    }
                    var manufacturer = Model[c][i];
                    
                    <td class="manfacturerCell">
                        <table>
                            <tr>
                                <td class="logoTD">
                                    <a href="@Url.Action("ManufacturerDetail", new { id = manufacturer.ID })">
                                    <img alt="Logo" src="../../Images/Carmark/12.jpg" height="80" width="80" />
                                    @manufacturer.Name
                                    </a>
                                </td>
                                <td class="brandsTD">
                                    <table>
                                        @foreach (var brand in manufacturer.Brands)
                                        {
                                        <tr>
                                            <td class="brandName">@Html.ActionLink(brand.Name, "Brand", new { id = brand.ID })</td>
                                            <td class="series">
                                            @foreach (var series in brand.Series)
                                            {
                                                @Html.ActionLink(series.Name, "Series", new { id = series.ID });
                                            }                                                                                                                       
                                            </td>
                                        </tr>
                                        }
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                    i++;
                    if (i % 2 == 0)
                    {
                @:</tr>
                    }
                    else if (i >= Model[c].Count)
                    {
                    <td class="manfacturerCell"></td>
                 @:</tr>
                   }
                }
            }
            </table>
        </div>
    </div>
     }

</div>